// xstddef standard header
#pragma once
#ifndef __XSTDDEF_
#define __XSTDDEF_
#ifndef RC_INVOKED
#include <yvals.h>

 #if _HAS_CPP0X
#include <xtr1common>
 #endif /* _HAS_CPP0X */


  #ifdef _M_CEE
template<class _Ty> inline
	void __CLRCALL_OR_CDECL _Bool_function(_Bool_struct<_Ty>&)
	{	// do nothing
	}

   #define _TYPEDEF_BOOL_TYPE	\
		typedef void (__CLRCALL_OR_CDECL * _Bool_type)(_STD _Bool_struct<_Myt>&)
   #define _CONVERTIBLE_TO_TRUE	(&_STD _Bool_function<_Myt>)
   #define _OPERATOR_BOOL		operator _Bool_type

  #else /* _M_CEE */
  // #define _TYPEDEF_BOOL_TYPE	\
		//typedef int _STD _Bool_struct<_Myt>::* _Bool_type
  // #define _CONVERTIBLE_TO_TRUE	(&_STD _Bool_struct<_Myt>::_Member)
  // #define _OPERATOR_BOOL		operator _Bool_type
  #endif /* _M_CEE */

 



#define _COMMA	,	/* for commas in macro parameters */

	// _VARIADIC_EXPAND* MACROS

 #if !defined(_VARIADIC_MAX)
  #define _VARIADIC_MAX	5

 #elif _VARIADIC_MAX < 5 || 10 < _VARIADIC_MAX
  #error _VARIADIC_MAX must be between 5 and 10, inclusive
 #endif /* !defined(_VARIADIC_MAX) */

 #if _VARIADIC_MAX == 5
#define _VARIADIC_EXPAND_2X	_VARIADIC_EXPAND_25
#define _VARIADIC_EXPAND_ALT_0X	_VARIADIC_EXPAND_ALT_05
#define _VARIADIC_EXPAND_P1_2X	_VARIADIC_EXPAND_P1_25
#define _VARIADIC_EXPAND_0_1X(FUNC) \
	_VARIADIC_EXPAND_XX_15(FUNC, _VARIADIC_EXPAND_0)
#define _VARIADIC_EXPAND_XX_1X(FUNC, EXPAND) \
	_VARIADIC_EXPAND_XX_15(FUNC, EXPAND)
#define _VARIADIC_EXPAND_1X_1D(FUNC) \
	_VARIADIC_EXPAND_15_1D(FUNC)

#define _PAD_LIST0	_PAD_LIST0_5
#define _PAD_LIST1	_PAD_LIST0_4
#define _PAD_LIST2	_PAD_LIST0_3
#define _PAD_LIST3	_PAD_LIST0_2
#define _PAD_LIST4	_PAD_LIST0_1
#define _PAD_LIST5	_PAD_LIST0_0

 #elif _VARIADIC_MAX == 6
#define _VARIADIC_EXPAND_2X	_VARIADIC_EXPAND_26
#define _VARIADIC_EXPAND_ALT_0X	_VARIADIC_EXPAND_ALT_06
#define _VARIADIC_EXPAND_P1_2X	_VARIADIC_EXPAND_P1_26
#define _VARIADIC_EXPAND_0_1X(FUNC) \
	_VARIADIC_EXPAND_XX_16(FUNC, _VARIADIC_EXPAND_0)
#define _VARIADIC_EXPAND_XX_1X(FUNC, EXPAND) \
	_VARIADIC_EXPAND_XX_16(FUNC, EXPAND)
#define _VARIADIC_EXPAND_1X_1D(FUNC) \
	_VARIADIC_EXPAND_16_1D(FUNC)

#define _PAD_LIST0	_PAD_LIST0_6
#define _PAD_LIST1	_PAD_LIST0_5
#define _PAD_LIST2	_PAD_LIST0_4
#define _PAD_LIST3	_PAD_LIST0_3
#define _PAD_LIST4	_PAD_LIST0_2
#define _PAD_LIST5	_PAD_LIST0_1
#define _PAD_LIST6	_PAD_LIST0_0

 #elif _VARIADIC_MAX == 7
#define _VARIADIC_EXPAND_2X	_VARIADIC_EXPAND_27
#define _VARIADIC_EXPAND_ALT_0X	_VARIADIC_EXPAND_ALT_07
#define _VARIADIC_EXPAND_P1_2X	_VARIADIC_EXPAND_P1_27
#define _VARIADIC_EXPAND_0_1X(FUNC) \
	_VARIADIC_EXPAND_XX_17(FUNC, _VARIADIC_EXPAND_0)
#define _VARIADIC_EXPAND_XX_1X(FUNC, EXPAND) \
	_VARIADIC_EXPAND_XX_17(FUNC, EXPAND)
#define _VARIADIC_EXPAND_1X_1D(FUNC) \
	_VARIADIC_EXPAND_17_1D(FUNC)

#define _PAD_LIST0	_PAD_LIST0_7
#define _PAD_LIST1	_PAD_LIST0_6
#define _PAD_LIST2	_PAD_LIST0_6
#define _PAD_LIST3	_PAD_LIST0_4
#define _PAD_LIST4	_PAD_LIST0_3
#define _PAD_LIST5	_PAD_LIST0_2
#define _PAD_LIST6	_PAD_LIST0_1
#define _PAD_LIST7	_PAD_LIST0_0

 #elif _VARIADIC_MAX == 8
#define _VARIADIC_EXPAND_2X	_VARIADIC_EXPAND_28
#define _VARIADIC_EXPAND_ALT_0X	_VARIADIC_EXPAND_ALT_08
#define _VARIADIC_EXPAND_P1_2X	_VARIADIC_EXPAND_P1_28
#define _VARIADIC_EXPAND_0_1X(FUNC) \
	_VARIADIC_EXPAND_XX_18(FUNC, _VARIADIC_EXPAND_0)
#define _VARIADIC_EXPAND_XX_1X(FUNC, EXPAND) \
	_VARIADIC_EXPAND_XX_18(FUNC, EXPAND)
#define _VARIADIC_EXPAND_1X_1D(FUNC) \
	_VARIADIC_EXPAND_18_1D(FUNC)

#define _PAD_LIST0	_PAD_LIST0_8
#define _PAD_LIST1	_PAD_LIST0_7
#define _PAD_LIST2	_PAD_LIST0_6
#define _PAD_LIST3	_PAD_LIST0_5
#define _PAD_LIST4	_PAD_LIST0_4
#define _PAD_LIST5	_PAD_LIST0_3
#define _PAD_LIST6	_PAD_LIST0_2
#define _PAD_LIST7	_PAD_LIST0_1
#define _PAD_LIST8	_PAD_LIST0_0

 #elif _VARIADIC_MAX == 9
#define _VARIADIC_EXPAND_2X	_VARIADIC_EXPAND_29
#define _VARIADIC_EXPAND_ALT_0X	_VARIADIC_EXPAND_ALT_09
#define _VARIADIC_EXPAND_P1_2X	_VARIADIC_EXPAND_P1_29
#define _VARIADIC_EXPAND_0_1X(FUNC) \
	_VARIADIC_EXPAND_XX_19(FUNC, _VARIADIC_EXPAND_0)
#define _VARIADIC_EXPAND_XX_1X(FUNC, EXPAND) \
	_VARIADIC_EXPAND_XX_19(FUNC, EXPAND)
#define _VARIADIC_EXPAND_1X_1D(FUNC) \
	_VARIADIC_EXPAND_19_1D(FUNC)

#define _PAD_LIST0	_PAD_LIST0_9
#define _PAD_LIST1	_PAD_LIST0_8
#define _PAD_LIST2	_PAD_LIST0_7
#define _PAD_LIST3	_PAD_LIST0_6
#define _PAD_LIST4	_PAD_LIST0_5
#define _PAD_LIST5	_PAD_LIST0_4
#define _PAD_LIST6	_PAD_LIST0_3
#define _PAD_LIST7	_PAD_LIST0_2
#define _PAD_LIST8	_PAD_LIST0_1
#define _PAD_LIST9	_PAD_LIST0_0

 #elif _VARIADIC_MAX == 10
#define _VARIADIC_EXPAND_2X	_VARIADIC_EXPAND_2A
#define _VARIADIC_EXPAND_ALT_0X	_VARIADIC_EXPAND_ALT_0A
#define _VARIADIC_EXPAND_P1_2X	_VARIADIC_EXPAND_P1_2A
#define _VARIADIC_EXPAND_0_1X(FUNC) \
	_VARIADIC_EXPAND_XX_1A(FUNC, _VARIADIC_EXPAND_0)
#define _VARIADIC_EXPAND_XX_1X(FUNC, EXPAND) \
	_VARIADIC_EXPAND_XX_1A(FUNC, EXPAND)
#define _VARIADIC_EXPAND_1X_1D(FUNC) \
	_VARIADIC_EXPAND_1A_1D(FUNC)

#define _PAD_LIST0	_PAD_LIST0_10
#define _PAD_LIST1	_PAD_LIST0_9
#define _PAD_LIST2	_PAD_LIST0_8
#define _PAD_LIST3	_PAD_LIST0_7
#define _PAD_LIST4	_PAD_LIST0_6
#define _PAD_LIST5	_PAD_LIST0_5
#define _PAD_LIST6	_PAD_LIST0_4
#define _PAD_LIST7	_PAD_LIST0_3
#define _PAD_LIST8	_PAD_LIST0_2
#define _PAD_LIST9	_PAD_LIST0_1
#define _PAD_LIST10	_PAD_LIST0_0
 #endif /* _VARIADIC_MAX */

// call FUNC(TEMPLATE_LIST, PADDING_LIST, LIST, COMMA, X1, X2, X3, X4)
#define _VARIADIC_EXPAND_0(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST0, _PAD_LIST0, _RAW_LIST0, , X1, X2, X3, X4)

#define _VARIADIC_EXPAND_1(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST1, _PAD_LIST1, _RAW_LIST1, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_2(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST2, _PAD_LIST2, _RAW_LIST2, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_3(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST3, _PAD_LIST3, _RAW_LIST3, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_4(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST4, _PAD_LIST4, _RAW_LIST4, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_5(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST5, _PAD_LIST5, _RAW_LIST5, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_6(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST6, _PAD_LIST6, _RAW_LIST6, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_7(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST7, _PAD_LIST7, _RAW_LIST7, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_8(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST8, _PAD_LIST8, _RAW_LIST8, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_9(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST9, _PAD_LIST9, _RAW_LIST9, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_10(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST10, _PAD_LIST10, _RAW_LIST10, _COMMA, X1, X2, X3, X4)

// alternate form for NxN expansion
#define _VARIADIC_EXPAND_ALT_0(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST0, _PAD_LIST0, _RAW_LIST0, , X1, X2, X3, X4)

#define _VARIADIC_EXPAND_ALT_1(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST1, _PAD_LIST1, _RAW_LIST1, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_ALT_2(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST2, _PAD_LIST2, _RAW_LIST2, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_ALT_3(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST3, _PAD_LIST3, _RAW_LIST3, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_ALT_4(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST4, _PAD_LIST4, _RAW_LIST4, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_ALT_5(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST5, _PAD_LIST5, _RAW_LIST5, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_ALT_6(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST6, _PAD_LIST6, _RAW_LIST6, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_ALT_7(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST7, _PAD_LIST7, _RAW_LIST7, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_ALT_8(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST8, _PAD_LIST8, _RAW_LIST8, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_ALT_9(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST9, _PAD_LIST9, _RAW_LIST9, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_ALT_A(FUNC, X1, X2, X3, X4) \
FUNC(_TEM_LIST10, _PAD_LIST10, _RAW_LIST10, _COMMA, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_25(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_2(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_3(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_4(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_5(FUNC, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_26(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_25(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_6(FUNC, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_27(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_26(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_7(FUNC, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_28(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_27(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_8(FUNC, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_29(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_28(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_9(FUNC, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_2A(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_29(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_10(FUNC, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_ALT_05(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_ALT_0(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_ALT_1(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_ALT_2(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_ALT_3(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_ALT_4(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_ALT_5(FUNC, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_ALT_06(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_ALT_05(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_ALT_6(FUNC, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_ALT_07(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_ALT_06(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_ALT_7(FUNC, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_ALT_08(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_ALT_07(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_ALT_8(FUNC, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_ALT_09(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_ALT_08(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_ALT_9(FUNC, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_ALT_0A(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_ALT_09(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_ALT_A(FUNC, X1, X2, X3, X4)

	// for 0-X args
#define _VARIADIC_EXPAND_0X(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_0(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_1X(FUNC, X1, X2, X3, X4)

#define _VARIADIC_EXPAND_1X(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_1(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_2X(FUNC, X1, X2, X3, X4)

	// for extra list, one element shorter
#define _VARIADIC_EXPAND_P1_0(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_0(FUNC, X1, X2, _RAW_LIST0, ) \

#define _VARIADIC_EXPAND_P1_1(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_1(FUNC, X1, X2, _RAW_LIST0, ) \

#define _VARIADIC_EXPAND_P1_25(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_2(FUNC, X1, X2, _RAW_LIST1, _COMMA) \
	_VARIADIC_EXPAND_3(FUNC, X1, X2, _RAW_LIST2, _COMMA) \
	_VARIADIC_EXPAND_4(FUNC, X1, X2, _RAW_LIST3, _COMMA) \
	_VARIADIC_EXPAND_5(FUNC, X1, X2, _RAW_LIST4, _COMMA)

#define _VARIADIC_EXPAND_P1_26(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_P1_25(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_6(FUNC, X1, X2, _RAW_LIST5, _COMMA)

#define _VARIADIC_EXPAND_P1_27(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_P1_26(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_7(FUNC, X1, X2, _RAW_LIST6, _COMMA)

#define _VARIADIC_EXPAND_P1_28(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_P1_27(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_8(FUNC, X1, X2, _RAW_LIST7, _COMMA)

#define _VARIADIC_EXPAND_P1_29(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_P1_28(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_9(FUNC, X1, X2, _RAW_LIST8, _COMMA)

#define _VARIADIC_EXPAND_P1_2A(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_P1_29(FUNC, X1, X2, X3, X4) \
	_VARIADIC_EXPAND_10(FUNC, X1, X2, _RAW_LIST9, _COMMA)

	// VARIADIC DOUBLE LOOPS
// call FUNC(TEMPLATE_LIST1, PADDING_LIST1, LIST1, COMMA1,
// TEMPLATE_LIST2, PADDING_LIST2, LIST2, COMMA2)

	// for (0-X, 0) args
#define _VARIADIC_EXPAND_0X_0(FUNC) \
	_VARIADIC_EXPAND_0X(FUNC, _TEM_LIST0, _PAD_LIST0, _RAW_LIST0, ) \

	// for (??, 1-X) args
#define _VARIADIC_EXPAND_XX_11(FUNC, EXPAND) \
	EXPAND(FUNC, _TEM_LIST1, _PAD_LIST1, _RAW_LIST1, _COMMA)

#define _VARIADIC_EXPAND_XX_12(FUNC, EXPAND) \
	_VARIADIC_EXPAND_XX_11(FUNC, EXPAND) \
	EXPAND(FUNC, _TEM_LIST2, _PAD_LIST2, _RAW_LIST2, _COMMA)

#define _VARIADIC_EXPAND_XX_13(FUNC, EXPAND) \
	_VARIADIC_EXPAND_XX_12(FUNC, EXPAND) \
	EXPAND(FUNC, _TEM_LIST3, _PAD_LIST3, _RAW_LIST3, _COMMA)

#define _VARIADIC_EXPAND_XX_14(FUNC, EXPAND) \
	_VARIADIC_EXPAND_XX_13(FUNC, EXPAND) \
	EXPAND(FUNC, _TEM_LIST4, _PAD_LIST4, _RAW_LIST4, _COMMA)

#define _VARIADIC_EXPAND_XX_15(FUNC, EXPAND) \
	_VARIADIC_EXPAND_XX_14(FUNC, EXPAND) \
	EXPAND(FUNC, _TEM_LIST5, _PAD_LIST5, _RAW_LIST5, _COMMA)

#define _VARIADIC_EXPAND_XX_16(FUNC, EXPAND) \
	_VARIADIC_EXPAND_XX_15(FUNC, EXPAND) \
	EXPAND(FUNC, _TEM_LIST6, _PAD_LIST6, _RAW_LIST6, _COMMA)

#define _VARIADIC_EXPAND_XX_17(FUNC, EXPAND) \
	_VARIADIC_EXPAND_XX_16(FUNC, EXPAND) \
	EXPAND(FUNC, _TEM_LIST7, _PAD_LIST7, _RAW_LIST7, _COMMA)

#define _VARIADIC_EXPAND_XX_18(FUNC, EXPAND) \
	_VARIADIC_EXPAND_XX_17(FUNC, EXPAND) \
	EXPAND(FUNC, _TEM_LIST8, _PAD_LIST8, _RAW_LIST8, _COMMA)

#define _VARIADIC_EXPAND_XX_19(FUNC, EXPAND) \
	_VARIADIC_EXPAND_XX_18(FUNC, EXPAND) \
	EXPAND(FUNC, _TEM_LIST9, _PAD_LIST9, _RAW_LIST9, _COMMA)

#define _VARIADIC_EXPAND_XX_1A(FUNC, EXPAND) \
	_VARIADIC_EXPAND_XX_19(FUNC, EXPAND) \
	EXPAND(FUNC, _TEM_LIST10, _PAD_LIST10, _RAW_LIST10, _COMMA)

	// for (n-X, n-X) args
#define _VARIADIC_EXPAND_0X_0X(FUNC) \
	_VARIADIC_EXPAND_0X_0(FUNC) \
	_VARIADIC_EXPAND_0_1X(FUNC) \
	_VARIADIC_EXPAND_1X_1X(FUNC)

#define _VARIADIC_EXPAND_1X_1X(FUNC) \
	_VARIADIC_EXPAND_XX_1X(FUNC, _VARIADIC_EXPAND_1X)

	// template lists for functions with no leading parameter
#define _TEM_LIST0(MAP)

#define _TEM_LIST1(MAP) \
	template<MAP(0)>

#define _TEM_LIST2(MAP) \
	template<MAP(0) _COMMA MAP(1)>

#define _TEM_LIST3(MAP) \
	template<MAP(0) _COMMA MAP(1) _COMMA MAP(2)>

#define _TEM_LIST4(MAP) \
	template<MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3)>

#define _TEM_LIST5(MAP) \
	template<MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) \
	_COMMA MAP(4)>

#define _TEM_LIST6(MAP) \
	template<MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) \
	_COMMA MAP(4) _COMMA MAP(5)>

#define _TEM_LIST7(MAP) \
	template<MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) \
	_COMMA MAP(4) _COMMA MAP(5) _COMMA MAP(6)>

#define _TEM_LIST8(MAP) \
	template<MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) \
	_COMMA MAP(4) _COMMA MAP(5) _COMMA MAP(6) _COMMA MAP(7)>

#define _TEM_LIST9(MAP) \
	template<MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) \
	_COMMA MAP(4) _COMMA MAP(5) _COMMA MAP(6) _COMMA MAP(7) \
	_COMMA MAP(8)>

#define _TEM_LIST10(MAP) \
	template<MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) \
	_COMMA MAP(4) _COMMA MAP(5) _COMMA MAP(6) _COMMA MAP(7) \
	_COMMA MAP(8) _COMMA MAP(9)>

	// diagonal, for (1-Y, 1-Z) args, Y+Z <= X
#define _VARIADIC_EXPAND_15_1D(FUNC) \
	_VARIADIC_EXPAND_1(FUNC, _TEM_LIST1, _PAD_LIST1, _RAW_LIST1, _COMMA) \
	_VARIADIC_EXPAND_1(FUNC, _TEM_LIST2, _PAD_LIST2, _RAW_LIST2, _COMMA) \
	_VARIADIC_EXPAND_1(FUNC, _TEM_LIST3, _PAD_LIST3, _RAW_LIST3, _COMMA) \
	_VARIADIC_EXPAND_1(FUNC, _TEM_LIST4, _PAD_LIST4, _RAW_LIST4, _COMMA) \
	_VARIADIC_EXPAND_2(FUNC, _TEM_LIST1, _PAD_LIST1, _RAW_LIST1, _COMMA) \
	_VARIADIC_EXPAND_2(FUNC, _TEM_LIST2, _PAD_LIST2, _RAW_LIST2, _COMMA) \
	_VARIADIC_EXPAND_2(FUNC, _TEM_LIST3, _PAD_LIST3, _RAW_LIST3, _COMMA) \
	_VARIADIC_EXPAND_3(FUNC, _TEM_LIST1, _PAD_LIST1, _RAW_LIST1, _COMMA) \
	_VARIADIC_EXPAND_3(FUNC, _TEM_LIST2, _PAD_LIST2, _RAW_LIST2, _COMMA) \
	_VARIADIC_EXPAND_4(FUNC, _TEM_LIST1, _PAD_LIST1, _RAW_LIST1, _COMMA)

#define _VARIADIC_EXPAND_16_1D(FUNC) \
	_VARIADIC_EXPAND_15_1D(FUNC) \
	_VARIADIC_EXPAND_1(FUNC, _TEM_LIST5, _PAD_LIST5, _RAW_LIST5, _COMMA) \
	_VARIADIC_EXPAND_2(FUNC, _TEM_LIST4, _PAD_LIST4, _RAW_LIST4, _COMMA) \
	_VARIADIC_EXPAND_3(FUNC, _TEM_LIST3, _PAD_LIST3, _RAW_LIST3, _COMMA) \
	_VARIADIC_EXPAND_4(FUNC, _TEM_LIST2, _PAD_LIST2, _RAW_LIST2, _COMMA) \
	_VARIADIC_EXPAND_5(FUNC, _TEM_LIST1, _PAD_LIST1, _RAW_LIST1, _COMMA)

#define _VARIADIC_EXPAND_17_1D(FUNC) \
	_VARIADIC_EXPAND_16_1D(FUNC) \
	_VARIADIC_EXPAND_1(FUNC, _TEM_LIST6, _PAD_LIST6, _RAW_LIST6, _COMMA) \
	_VARIADIC_EXPAND_2(FUNC, _TEM_LIST5, _PAD_LIST5, _RAW_LIST5, _COMMA) \
	_VARIADIC_EXPAND_3(FUNC, _TEM_LIST4, _PAD_LIST4, _RAW_LIST4, _COMMA) \
	_VARIADIC_EXPAND_4(FUNC, _TEM_LIST3, _PAD_LIST3, _RAW_LIST3, _COMMA) \
	_VARIADIC_EXPAND_5(FUNC, _TEM_LIST2, _PAD_LIST2, _RAW_LIST2, _COMMA) \
	_VARIADIC_EXPAND_6(FUNC, _TEM_LIST1, _PAD_LIST1, _RAW_LIST1, _COMMA)

#define _VARIADIC_EXPAND_18_1D(FUNC) \
	_VARIADIC_EXPAND_17_1D(FUNC) \
	_VARIADIC_EXPAND_1(FUNC, _TEM_LIST7, _PAD_LIST7, _RAW_LIST7, _COMMA) \
	_VARIADIC_EXPAND_2(FUNC, _TEM_LIST6, _PAD_LIST6, _RAW_LIST6, _COMMA) \
	_VARIADIC_EXPAND_3(FUNC, _TEM_LIST5, _PAD_LIST5, _RAW_LIST5, _COMMA) \
	_VARIADIC_EXPAND_4(FUNC, _TEM_LIST4, _PAD_LIST4, _RAW_LIST4, _COMMA) \
	_VARIADIC_EXPAND_5(FUNC, _TEM_LIST3, _PAD_LIST3, _RAW_LIST3, _COMMA) \
	_VARIADIC_EXPAND_6(FUNC, _TEM_LIST2, _PAD_LIST2, _RAW_LIST2, _COMMA) \
	_VARIADIC_EXPAND_7(FUNC, _TEM_LIST1, _PAD_LIST1, _RAW_LIST1, _COMMA)

#define _VARIADIC_EXPAND_19_1D(FUNC) \
	_VARIADIC_EXPAND_18_1D(FUNC) \
	_VARIADIC_EXPAND_1(FUNC, _TEM_LIST8, _PAD_LIST8, _RAW_LIST8, _COMMA) \
	_VARIADIC_EXPAND_2(FUNC, _TEM_LIST7, _PAD_LIST7, _RAW_LIST7, _COMMA) \
	_VARIADIC_EXPAND_3(FUNC, _TEM_LIST6, _PAD_LIST6, _RAW_LIST6, _COMMA) \
	_VARIADIC_EXPAND_4(FUNC, _TEM_LIST5, _PAD_LIST5, _RAW_LIST5, _COMMA) \
	_VARIADIC_EXPAND_5(FUNC, _TEM_LIST4, _PAD_LIST4, _RAW_LIST4, _COMMA) \
	_VARIADIC_EXPAND_6(FUNC, _TEM_LIST3, _PAD_LIST3, _RAW_LIST3, _COMMA) \
	_VARIADIC_EXPAND_7(FUNC, _TEM_LIST2, _PAD_LIST2, _RAW_LIST2, _COMMA) \
	_VARIADIC_EXPAND_8(FUNC, _TEM_LIST1, _PAD_LIST1, _RAW_LIST1, _COMMA)

#define _VARIADIC_EXPAND_1A_1D(FUNC) \
	_VARIADIC_EXPAND_19_1D(FUNC) \
	_VARIADIC_EXPAND_1(FUNC, _TEM_LIST9, _PAD_LIST9, _RAW_LIST9, _COMMA) \
	_VARIADIC_EXPAND_2(FUNC, _TEM_LIST8, _PAD_LIST8, _RAW_LIST8, _COMMA) \
	_VARIADIC_EXPAND_3(FUNC, _TEM_LIST7, _PAD_LIST7, _RAW_LIST7, _COMMA) \
	_VARIADIC_EXPAND_4(FUNC, _TEM_LIST6, _PAD_LIST6, _RAW_LIST6, _COMMA) \
	_VARIADIC_EXPAND_5(FUNC, _TEM_LIST5, _PAD_LIST5, _RAW_LIST5, _COMMA) \
	_VARIADIC_EXPAND_6(FUNC, _TEM_LIST4, _PAD_LIST4, _RAW_LIST4, _COMMA) \
	_VARIADIC_EXPAND_7(FUNC, _TEM_LIST3, _PAD_LIST3, _RAW_LIST3, _COMMA) \
	_VARIADIC_EXPAND_8(FUNC, _TEM_LIST2, _PAD_LIST2, _RAW_LIST2, _COMMA) \
	_VARIADIC_EXPAND_9(FUNC, _TEM_LIST1, _PAD_LIST1, _RAW_LIST1, _COMMA)

	// padding lists
#define _PAD_LIST0_0(MAP) \
	MAP(0)

#define _PAD_LIST0_1(MAP) \
	MAP(0) _COMMA MAP(1)

#define _PAD_LIST0_2(MAP) \
	MAP(0) _COMMA MAP(1) _COMMA MAP(2)

#define _PAD_LIST0_3(MAP) \
	MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3)

#define _PAD_LIST0_4(MAP) \
	MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) _COMMA \
	MAP(4)

#define _PAD_LIST0_5(MAP) \
	MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) _COMMA \
	MAP(4) _COMMA MAP(5)

#define _PAD_LIST0_6(MAP) \
	MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) _COMMA \
	MAP(4) _COMMA MAP(5) _COMMA MAP(6)

#define _PAD_LIST0_7(MAP) \
	MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) _COMMA \
	MAP(4) _COMMA MAP(5) _COMMA MAP(6) _COMMA MAP(7)

#define _PAD_LIST0_8(MAP) \
	MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) _COMMA \
	MAP(4) _COMMA MAP(5) _COMMA MAP(6) _COMMA MAP(7) _COMMA \
	MAP(8)

#define _PAD_LIST0_9(MAP) \
	MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) _COMMA \
	MAP(4) _COMMA MAP(5) _COMMA MAP(6) _COMMA MAP(7) _COMMA \
	MAP(8) _COMMA MAP(9)

#define _PAD_LIST0_10(MAP) \
	MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) _COMMA \
	MAP(4) _COMMA MAP(5) _COMMA MAP(6) _COMMA MAP(7) _COMMA \
	MAP(8) _COMMA MAP(9) _COMMA MAP(10)

	// plain lists
#define _RAW_LIST0(MAP)

#define _RAW_LIST1(MAP) \
	MAP(0)

#define _RAW_LIST2(MAP) \
	MAP(0) _COMMA MAP(1)

#define _RAW_LIST3(MAP) \
	MAP(0) _COMMA MAP(1) _COMMA MAP(2)

#define _RAW_LIST4(MAP) \
	MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3)

#define _RAW_LIST5(MAP) \
	MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) \
	_COMMA MAP(4)

#define _RAW_LIST6(MAP) \
	MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) \
	_COMMA MAP(4) _COMMA MAP(5)

#define _RAW_LIST7(MAP) \
	MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) \
	_COMMA MAP(4) _COMMA MAP(5) _COMMA MAP(6)

#define _RAW_LIST8(MAP) \
	MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) \
	_COMMA MAP(4) _COMMA MAP(5) _COMMA MAP(6) _COMMA MAP(7)

#define _RAW_LIST9(MAP) \
	MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) \
	_COMMA MAP(4) _COMMA MAP(5) _COMMA MAP(6) _COMMA MAP(7) \
	_COMMA MAP(8)

#define _RAW_LIST10(MAP) \
	MAP(0) _COMMA MAP(1) _COMMA MAP(2) _COMMA MAP(3) \
	_COMMA MAP(4) _COMMA MAP(5) _COMMA MAP(6) _COMMA MAP(7) \
	_COMMA MAP(8) _COMMA MAP(9)

	// variant calling sequences

 #if defined(_M_IX86)

 #if defined(_M_CEE)
#define _VARIADIC_CALL_OPT_X1(FUNC, X1, X2, X3, X4, \
	CALL_OPT, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, CALL_OPT, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, __stdcall, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, __clrcall, X6, X7, X8)

 #else /* defined(_M_CEE) */
#define _VARIADIC_CALL_OPT_X1(FUNC, X1, X2, X3, X4, \
	CALL_OPT, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, CALL_OPT, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, __stdcall, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, __fastcall, X6, X7, X8)
 #endif /* defined(_M_CEE) */

#else /* defined (_M_IX86) */

 #if defined(_M_CEE)
#define _VARIADIC_CALL_OPT_X1(FUNC, X1, X2, X3, X4, \
	CALL_OPT, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, CALL_OPT, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, __clrcall, X6, X7, X8)

 #else /* defined(_M_CEE) */
#define _VARIADIC_CALL_OPT_X1(FUNC, X1, X2, X3, X4, \
	CALL_OPT, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, CALL_OPT, X6, X7, X8)
 #endif /* defined(_M_CEE) */
 #endif /* defined (_M_IX86) */

 #if defined(_M_IX86)

 #if defined(_M_CEE)
#define _VARIADIC_CALL_OPT_X2(FUNC, X1, X2, X3, X4, \
	CALL_OPT, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, CALL_OPT, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, __cdecl, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, __stdcall, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, __clrcall, X6, X7, X8)

 #else /* defined(_M_CEE) */
#define _VARIADIC_CALL_OPT_X2(FUNC, X1, X2, X3, X4, \
	CALL_OPT, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, CALL_OPT, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, __cdecl, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, __stdcall, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, __fastcall, X6, X7, X8)
 #endif /* defined(_M_CEE) */

#else /* defined (_M_IX86) */

 #if defined(_M_CEE)
#define _VARIADIC_CALL_OPT_X2(FUNC, X1, X2, X3, X4, \
	CALL_OPT, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, CALL_OPT, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, __clrcall, X6, X7, X8)

 #else /* defined(_M_CEE) */
#define _VARIADIC_CALL_OPT_X2(FUNC, X1, X2, X3, X4, \
	CALL_OPT, X6, X7, X8) \
		FUNC(X1, X2, X3, X4, CALL_OPT, X6, X7, X8)
 #endif /* defined(_M_CEE) */
 #endif /* defined (_M_IX86) */

	// MAP functions
#define _VAR_VAL(NUM)	\
	_V ## NUM
#define _VAR_TYPE(NUM)	\
	_VAR_VAL(NUM) ## _t
#define _CLASS_TYPE(NUM)	\
	class _VAR_TYPE(NUM)

#define _VAR_VALX(NUM)	\
	_Vx ## NUM
#define _VAR_TYPEX(NUM)	\
	_VAR_VALX(NUM) ## _t
#define _CLASS_TYPEX(NUM)	\
	class _VAR_TYPEX(NUM)

#define _CLASS_TYPE_TYPEX(NUM)	\
	class _VAR_TYPE(NUM) _COMMA class _VAR_TYPEX(NUM)

#define _CLASS_NIL(NUM)	\
	class = tr1::_Nil
#define _CLASS_TYPE_NIL(NUM)	\
	class _VAR_TYPE(NUM) = tr1::_Nil
#define _NIL_PAD(NUM)	\
	tr1::_Nil

#define _ARG(NUM) \
	_VAR_VAL(NUM)
#define _DECLVAL(NUM)	\
	_STD declval<_VAR_TYPE(NUM)>()
#define _DECAY_COPY_FORWARD_ARG(NUM)	\
	_Decay_copy(_STD forward<_TYPE(NUM)>(_VAR_VAL(NUM)))
#define _REMOVE_REF(NUM)	\
	typename remove_reference<_TYPE(NUM)>::type&
#define _UNREFWRAP_TYPE(NUM)	\
	typename _Unrefwrap<_TYPE(NUM)>::type

#define _ELEMENT_ARG(NUM)	\
	_STD get<NUM>(_Tpl1)
#define _FORWARD_ARG(NUM)	\
	_STD forward<_VAR_TYPE(NUM)>(_VAR_VAL(NUM))
#define _FORWARD_ELEMENT_ARG(NUM)	\
	_STD get<NUM>(_STD forward<decltype(_Tpl1)>(_Tpl1))

#define _ELEMENT_ARGX(NUM)	\
	_STD get<NUM>(_Tpl2)
#define _FORWARD_ARGX(NUM)	\
	_STD forward<_VAR_TYPEX(NUM)>(_VAR_VALX(NUM))
#define _FORWARD_ELEMENT_ARGX(NUM)	\
	_STD get<NUM>(_STD forward<decltype(_Tpl2)>(_Tpl2))

#define _TYPE(NUM) \
	_VAR_TYPE(NUM)
#define _TYPE_REF(NUM)	\
	_VAR_TYPE(NUM)&
#define _TYPE_REFREF(NUM)	\
	_VAR_TYPE(NUM)&&
#define _TYPE_ARG(NUM) \
	_VAR_TYPE(NUM) _VAR_VAL(NUM)
#define _TYPE_REF_ARG(NUM)	\
	_TYPE_REF(NUM) _VAR_VAL(NUM)
#define _TYPE_REFREF_ARG(NUM)	\
	_TYPE_REFREF(NUM) _VAR_VAL(NUM)
#define _CONST_TYPE_REF_ARG(NUM)	\
	const _TYPE(NUM)& _VAR_VAL(NUM)

#define _TYPEX(NUM) \
	_VAR_TYPEX(NUM)
#define _TYPEX_REF(NUM)	\
	_VAR_TYPEX(NUM)&
#define _TYPEX_REFREF(NUM)	\
	_VAR_TYPEX(NUM)&&
#define _TYPEX_ARG(NUM) \
	_VAR_TYPEX(NUM) _VAR_VALX(NUM)
#define _TYPEX_REF_ARG(NUM)	\
	_TYPEX_REF(NUM) _VAR_VALX(NUM)
#define _TYPEX_REFREF_ARG(NUM)	\
	_TYPEX_REFREF(NUM) _VAR_VALX(NUM)
#define _DECAY_TYPEX(NUM) \
	typename decay<_TYPEX(NUM)>::type

// NB: Need an extra class to avoid specializing initial template declaration
#define _MAX_CLASS_LIST	\
	_PAD_LIST0(_CLASS_TYPE_NIL) _COMMA class = tr1::_Nil
#define _MAX_NIL_CLASS_LIST	\
	_PAD_LIST0(_CLASS_NIL) _COMMA class = tr1::_Nil
#define _MAX_NIL_LIST	\
	_PAD_LIST0(_NIL_PAD) _COMMA tr1::_Nil
#define _MAX_ALIST \
	_PAD_LIST0(_TYPE)

_STD_BEGIN
		// TEMPLATE CLASS _Sizeof
template<class = tr1::_Nil, _MAX_CLASS_LIST>
	struct _Sizeof;

template<>
	struct _Sizeof<tr1::_Nil, _MAX_NIL_LIST>
	{	// no parameters
	static const size_t value = 0;
	};

#define _CLASS_SIZEOF( \
	TEMPLATE_LIST, PADDING_LIST, LIST, COMMA, X1, X2, X3, X4) \
template<class _Ty COMMA LIST(_CLASS_TYPE)> \
	struct _Sizeof<_Ty COMMA LIST(_TYPE), PADDING_LIST(_NIL_PAD)> \
	{	/* get length of LIST(_TYPE) from smaller */ \
	static const size_t value = 1 + _Sizeof<LIST(_TYPE)>::value; \
	};

_VARIADIC_EXPAND_0X(_CLASS_SIZEOF, , , , )
#undef _CLASS_SIZEOF

_STD_END


#endif /* RC_INVOKED */
#endif /* _XSTDDEF_ */

/*
 * Copyright (c) 1992-2011 by P.J. Plauger.  ALL RIGHTS RESERVED.
 * Consult your license regarding permissions and restrictions.
V5.40:0009 */
